<template>
  <div>
    <addInp></addInp>
    <div>
      <ul>
        <li
          v-for="(item, index) in this.$store.state.infoList"
          :key="item.id"
          v-show="!item.status"
          :class="item.status ? 'over' : 'noOk'"
        >
          {{ index + 1 }} -- {{ item.msg }}
          <button class="btn" v-if="!item.status" @click="over(item.id)">
            还未完成哦
          </button>
          <button class="btn" v-else @click="over(item.id)">已完成了哦</button>
          <button class="btn" @click="out(item.id)">删除哦</button>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import addInp from "./addInp.vue";

export default {
  components: { addInp },
  methods: {
    over(id) {
      this.$store.commit("overList", id);
    },
    out(id) {
      this.$store.commit("removeAddList", id);
    },
  },
};
</script>
<style>
.over {
  color: aqua;
  text-decoration: line-through;
}
.noOk {
  color: red;
}
ul li {
  height: 35px;
}
.btn {
  float: right;
  height: 25px;
  margin-left: 10px;
}
</style>
